package com.bwie.controller;

import com.bwie.pojo.TbAsset;
import com.bwie.pojo.TbSave;
import com.bwie.service.TbAssetService;
import com.bwie.utils.R;
import com.bwie.utils.Result;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author : Yoo19
 * @description :
 * @createDate : 2025/7/3 9:45 45
 */
@RestController
@RequestMapping("/asset")
public class AssetController {
    @Autowired
    private TbAssetService tbAssetService;

    /**
     * 获取用户的总资产数据
     * @param userId
     * @return
     */
    @ApiOperation("获取用户的总资产数据")
    @PostMapping("/getAssetList/{userId}")
    public R getAssetList(@PathVariable("userId")Integer userId){
        return tbAssetService.getAssetList(userId);
    }

    /**
     * 获取用户的存钱宝数据
     * @param userId
     * @return
     */
    @ApiOperation("获取用户的存钱宝数据")
    @PostMapping("/getSaveList/{userId}")
    public Result getSave(@PathVariable("userId")Integer userId){
        return tbAssetService.getSaveList(userId);
    }

    /**
     * 获取用户的借呗数据
     * @param userId
     * @return
     */
    @ApiOperation("获取用户的借呗数据")
    @PostMapping("/getBorrowList/{userId}")
    public R getBorrowList(@PathVariable("userId")Integer userId){
        return tbAssetService.getBorrowList(userId);
    }


    @ApiOperation("存钱宝提现")
    @PostMapping("/tx")
    public Result tx(@RequestBody TbSave tbSave,@RequestBody TbAsset tbAsset){
        return tbAssetService.tx(tbSave,tbAsset);
    }

    @PostMapping("/getCardList/{typeId}")
    public R getCardList(@PathVariable("typeId")Integer typeId){
        return tbAssetService.getCardList(typeId);
    }

}
